

	var app = new Vue({
	  el: '#app',
	  data: {
        isTraining: 1,
        isLogin: false,
        isWrite: true,
        isInfomation: false,
        verificationBot: '发送验证码',
        countDownTime: 60,
        VerificationInd: '',
        controller: {
            alertText:''
        },
        message: {
            phone: '',
            verification: ''
        },
        basicInformationLink: 'basicInformation.html?code=1',
        user: {
          name: '未认证',
          site:'',
          icon:'images/icon.jpg',
          resume: {
            text:'完善个人信息',
            link: 'javascript:void(0)'
          },
          star:{
            ind:3,
            text:'三星月嫂'
          },
          tiemlist:[],
          personalInformation:{
            link:'javascript:void(0)',
            ind:0
          },
          photo:{
            link:'javascript:void(0)',
            ind:0,
          },

        },
        neutralGear:'neutralGear.html',
        appraisal:'javascript:void(0)',



	  },
    methods: {
			LogOut:function() {
				loginObj.LogOut();
			},
      GetUserInfo: function() {

         axios.get(severUrl+'houseWorkerMainInfo?ids='+ (loginObj.getLogoinStatus()).phone).then(function(response) {
          var dataind = response.data;
          // console.log(dataind)

           if (dataind.status == 200) {
            var data = dataind.data;

            this.app.user.tiemlist = data.neutralInfo;
            this.app.user.name = data.memberInfo.name;
            this.app.user.icon = data.memberInfo.avatar;
            this.app.user.site = data.memberInfo.current_live_city;



            this.app.user.star.ind = data.memberInfo.stars;
            this.app.user.personalInformation.ind = data.memberInfo.proportion;
            this.app.user.photo.ind = data.workPhoto;


            this.app.user.resume.link = '/resume/index.html?'+window.btoa('id='+data.memberInfo.id);
            this.app.user.resume.text = '免费精美简历';

            this.app.user.photo.link = 'AddPhoto.html';
            this.app.neutralGear = 'neutralGear.html';
            this.app.appraisal = 'testAunt.html';

            this.app.isInfomation = false;

            if (data.workLevel.length < 0) {
              this.app.user.star.text = data.workLevel[0]
            }else{
              this.app.user.star.text = '暂无星级'
            }
           }else{
            this.app.user.resume.link = 'basicInformation.html?code='+this.app.isTraining;
            this.app.user.resume.text = '完善个人信息';
            this.app.user.photo.link = 'javascript:void(0)';
            this.app.neutralGear = 'javascript:void(0)';
            this.app.appraisal = 'javascript:void(0)';
            this.app.isInfomation = true;

           }

        });
      },
      verificationAjaxFun: function() {
            if (checkPhone(this.message.phone) ) {

                if (!(this.message.verification.length < 6)) {
                    if (this.message.verification == this.VerificationInd) {

                       this.basicInformationLink = 'basicInformation.html?code=' + this.isTraining;
                        loginObj.setLogoinInfo(this.message.phone, this.isTraining);



                        this.isWrite = false;
                        this.GetUserInfo();

                    }else{
                        this.AlertConFun('验证码错误!')

                    }
                }else{
                     this.AlertConFun('请正确填写验证码')
                }

            }else{
               this.AlertConFun('请正确填写手机号码')
            }


        },
        GetVerificationAjaxFun: function() {
            if (this.countDownTime == 60) {
                if (checkPhone(this.message.phone)) {

                    this.countDown();
                    axios.get(severUrl+'sendPhone?phone='+app._data.message.phone).then(function(response) {

                      console.log(response.data)

                       if (response.data.code == 1) {
                            app._data.VerificationInd = response.data.data.verificationCode;

                        }

                    });

                }else{
                    console.log(false)
                    this.AlertConFun('请正确填写手机号码')


                }
            }



        },
        countDown:function() {
            if (this.countDownTime != 0) {
                this.countDownTime --;
                this.verificationBot = this.countDownTime +'秒';
                setTimeout(function() {
                    this.app.countDown();
                },1000)

            }else{
                this.countDownTime = 60;
                this.verificationBot = '发送验证码';

            }

        },
        AlertConFun: function(string) {
            this.controller.alertText = string;
            setTimeout(function(argument) {
                this.app._data.controller.alertText = false;
            },1500)

        }

    },
    watch: {


     },
     beforeCreate: function() {
         // console.log(this)
    },

    created: function (){
      var porject = loginObj.getLogoinStatus();


			window.localStorage.userid = GetQueryString('userid') || 0



        console.log(porject)
        if (porject.phone) {
          this.isTraining = porject.code;

          this.basicInformationLink = 'basicInformation.html?code='+porject.code;
          this.isWrite = false;
          this.GetUserInfo();

        }else{
          this.isWrite = true;
        }


    }

	})
